package com.jsb.laundry.dao;

import com.jsb.laundry.model.entity.CapitalAccount;
import com.jsb.laundry.model.entity.CapitalAccountUnstLog;
import com.jsb.laundry.model.vo.PayListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Mapper
public interface ServeDao {
    /**
     * 查询服务
     *
     * @param id
     * @return
     */
    Map findServiceById(String id);

    int findByUserIdOkFlag(String userId);
    /**
     * 支付列表
     * @return
     */
    List<PayListVo>payList();
    /**
     * 根据userid查询用户
     * @param userId
     * @return
     */
    String findByOpenId(String userId);
    int addCapitalAccountUnstLog(CapitalAccountUnstLog capitalAccountLog);
    CapitalAccount capitalAccountInfo(@Param("thirdpartId")String thirdpartId,@Param("type") String type);
    CapitalAccount capitalAccountInfoForUpdate(String id);
    List<CapitalAccountUnstLog> findByCapitalAccountUnstLogList(String relatedNo);
    int capitalAccountLogadd(CapitalAccountUnstLog capitalAccount);
    int findByOrderMoney(String orderId);
    /**
     * 查看开通服务
     *
     * @param userId
     * @return
     */
    List<HashMap> findOpenServiceLogByUserId(String userId);

    /**
     * 添加购买记录
     *
     * @param serviceId
     * @param userId
     * @return
     */
    int addOpenServiceLogInfo(@Param("serviceId") String serviceId, @Param("userId") String userId, @Param("payId") String payId);

    int updateStatus(String payId);

    int findByUserId(String thirdpartId);

    int addUserInfo(String thirdpartId);

    int updByUserId(@Param("thirdpartId") String thirdpartId,
                    @Param("frozenAmount") int frozenAmount

    );

    CapitalAccount findByCapitalAccount(String userId);

    String findByUserIdAndPayId(String userId);
    /**
     *更新待结算
     * @param amount
     * @param id
     * @return
     */
    int updatedepositfreezeadd(@Param("amount")int amount,@Param("id")String id);
    int updatedepositfreezesub(@Param("amount")int amount,@Param("id")String id);
    int updateDepositAdd (@Param("amount")int amount,@Param("id")String id);
    int updateDepositSub (@Param("amount")int amount,@Param("id")String id);
    int updateIsSett(@Param("relatedNo")String relatedNo,@Param("id")String id);
    /**
     * 累计收入
     * @param userId
     * @return
     */
    String accumulatedIncome(String userId);
    /**
     * 上岗考试分数查询
     * @param userId
     * @return
     */
    int findByUserIdFraction(String userId);

    /**
     * 查询改用户是否参与答题
     * @param userId
     * @return
     */
    int findByQuestionLog(String userId);
    String payid (String payId);
}
